package com.ljc.cjgl.entitiy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

import com.ljc.cjgl.custom.Customer;

@Entity
public class Teacher implements Customer{
	private Integer id;
	private String name;
	private String pwd="123456";
	private Integer userType=0; //0:普通老师，1：管理员
	
	public Teacher() {
		super();
	}
	
	public Teacher(Integer id) {
		super();
		this.id = id;
	}
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(length=10)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(length=10)
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	
	public Integer getUserType() {
		return userType;
	}
	public void setUserType(Integer userType) {
		this.userType = userType;
	}
	
	public Teacher(Integer id, String name, String pwd, Integer userType) {
		super();
		this.id = id;
		this.name = name;
		this.pwd = pwd;
		this.userType = userType;
	}
	
	@Transient
	public String getRole() {
		if(userType==0) {
			return "老师";
		}else {
			return "管理员";
		}
	}

	@Override
	@Transient
	public String getUserId() {
		return name;
	}

}
